cmake_minimum_required(VERSION 3.29.0) # CMAKE 版本
project(cppwinapi LANGUAGES CXX)  # 声明项目使用 C++
set(CMAKE_CXX_STANDARD 20)        # 指定 C++20
set(CMAKE_CXX_STANDARD_REQUIRED ON)  # 强制要求编译器支持 C++20
set(CMAKE_CXX_EXTENSIONS ON)     # 禁用编译器扩展（如 GNU 的 `-std=gnu++20`）
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")

# 查找依赖库
find_package(CURL REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(Boost REQUIRED COMPONENTS algorithm)
find_package(boost_uuid CONFIG REQUIRED)

file(GLOB_RECURSE CPP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")

# 打印文件列表（调试用）
message(STATUS "Found CPP files: ${CPP_FILES}")

# 定义可执行文件
add_executable(${CMAKE_PROJECT_NAME} ${CPP_FILES})

# 设置包含目录（必须在 add_executable 后调用）
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE "${PROJECT_SOURCE_DIR}/include")


target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE CURL::libcurl)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE nlohmann_json::nlohmann_json)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE Boost::algorithm)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE Boost::uuid)

# 引入 DLL 拷贝逻辑
# include(${CMAKE_CURRENT_SOURCE_DIR}/build_scripts/CopyDLLs.cmake)
# 引入 TTL 拷贝逻辑
# include(${CMAKE_CURRENT_SOURCE_DIR}/build_scripts/CopyFonts.cmake)